package com.xiaoze.pool.controller;

import com.xiaoze.pool.fetcher.KuaiDailiFetcher;
import com.xiaoze.pool.fetcher.Www66IPFetcher;
import com.xiaoze.pool.fetcher.XichiDailiFetcher;
import com.xiaoze.pool.utils.HtmlUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ProxyController {


    @GetMapping("/")
    public String getProxy() throws Exception {

        KuaiDailiFetcher k = new KuaiDailiFetcher();
        XichiDailiFetcher x = new XichiDailiFetcher();
        Www66IPFetcher w = new Www66IPFetcher();

        for(int i = 1; i < 9; i++){
            String pageUrl = HtmlUtils.getHtml(k.pageUrl(i));
            k.parseHtml(pageUrl);
        }

        for(int i = 1; i < 9; i++){
            String pageUrl = HtmlUtils.getHtml(x.pageUrl(i));
            x.parseHtml(pageUrl);
        }

        for(int i = 1; i < 9; i++){
            String pageUrl = HtmlUtils.getHtml(w.pageUrl(i));
            w.parseHtml(pageUrl);
        }

        return "你好！";
    }
}
